//
//  UINavigationBar+NED.m
//  MoreCoin
//
//  Created by 林宁宁 on 2019/9/20.
//  Copyright © 2019 MoreCoin. All rights reserved.
//

#import "UINavigationBar+NED.h"
#import "UIColor+NEDStyle.h"
#import "UIFont+NED.h"

@implementation UINavigationBar (NED)


-(void)ned_setNavigationBar{
    // 去掉navigationbar的分割线
    [self setShadowImage:[UIImage new]];
    [self setTranslucent:NO]; // 设置navigationBar的透明效果
    [self setTintColor:[UIColor ned_navigationTint]];
    
    NSDictionary *attrs = @{NSFontAttributeName: [UIFont ned_hnbOfSize:18],
                            NSForegroundColorAttributeName:[UIColor ned_navigationTitle]};
    
    if (@available(iOS 13.0, *)) {
        
        UINavigationBarAppearance * appearance = [UINavigationBarAppearance new];
        appearance.backgroundColor = [UIColor ned_navigationBackground];
        appearance.titleTextAttributes = attrs;
        appearance.shadowColor = [UIColor clearColor];
        self.standardAppearance = appearance;
        self.scrollEdgeAppearance = appearance;
    }else{
        [self setTitleTextAttributes:attrs];
        [self setBackgroundImage:[[UIColor ned_navigationBackground] ned_drawImageWithColor] forBarMetrics:UIBarMetricsDefault];
    }
}

@end
